home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 19.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.9 KB  |  297 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18.     call Settings()
  19.     call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20.     line = readln(TempFile)
  21.     Color = strip(line)
  22.     line = readln(TempFile)
  23.     ColorPic = strip(line)
  24.     line = readln(TempFile)
  25.     PicName = strip(line)
  26.     line = readln(TempFile)
  27.     Scroll = strip(line)
  28.     line = readln(TempFile)
  29.     XOff = strip(line)
  30.     line = readln(TempFile)
  31.     YOff = strip(line)
  32.     line = readln(TempFile)
  33.     Type = strip(line)
  34.     call close (TempFile)
  35.     ActiveColor Color
  36.     ActiveColor
  37.     j = 0
  38.     TFrames = Frames
  39.     if Field = 1 then TFrames = Frames*2
  40.     do i = 1 to Frames
  41.         call open TempFile,"RAM:VFXNums",W
  42.         call writeln TempFile,right(i,5,'0')
  43.         call writeln TempFile,right(Frames,5,'0')
  44.         call close TempFile
  45.         f = 0
  46.         Redraw Off
  47.         FieldSet = 0
  48.         if Padding ~= -1 & i = 1 then call PadIt(1)
  49.         call LoadB()
  50.         call LoadA()
  51.         j = j + 1
  52.         call DoIt()
  53.         Redraw On
  54.         call SaveIt()
  55.         if Field = 1 then do
  56.             Redraw Off
  57.             FieldSet = 1
  58.             call LoadB()
  59.             call LoadA()
  60.             j = j + 1
  61.             call DoIt()
  62.             Redraw On
  63.             call SaveIt()
  64.             end 
  65.         if Padding ~= -1 & i = Frames then call PadIt(2)
  66.         end
  67.     if SaveType = 0 then do
  68.         if Padding = -1 then
  69.             call MakeIcon(SaveName,(Frames-10))
  70.         else
  71.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  72.         end
  73.     ActiveColor 1
  74.     ActiveColor
  75.     Undo On
  76. exit
  77.  
  78.  
  79. PadIt:
  80. arg PadNum
  81.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  82.         Undo On
  83.         exit
  84.         end
  85.          if PadNum = 1 then do
  86.        if IAType = 0 then do
  87.         do Pad = Padding to 1 by -1
  88.             LoadBuffer PicAName Force StartA-(Pad-1)
  89.             call Switcher(TOSW)
  90.             call Switcher(MDV1)
  91.             Render Go
  92.                 call RecordAdd(SaveName,2,6,Compression)
  93.             end
  94.         end
  95.        if IAType = 1 then do
  96.         LoadBuffer PicAName Force 1
  97.         call Switcher(TOSW)
  98.         call Switcher(MDV1)
  99.         Render Go
  100.             call RecordAdd(SaveName,2*Padding,6,Compression)
  101.         end
  102.        if IAType = 2 then do
  103.         LoadBuffer PicAName Force
  104.         call Switcher(TOSW)
  105.         call Switcher(MDV1)
  106.         Render Go
  107.             call RecordAdd(SaveName,2*Padding,6,Compression)
  108.         end
  109.        if IAType = 3 then do
  110.         do Pad = Padding to 1 by -1
  111.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  112.             call Switcher(TOSW)
  113.             call Switcher(MDV1)
  114.             Render Go
  115.                 call RecordAdd(SaveName,2,6,Compression)
  116.             end
  117.         end
  118.     end 
  119.     else do
  120.        if IBType = 0 then do
  121.         do Pad = 1 to Padding
  122.             LoadBuffer PicBName Force StartB+Pad+Frames
  123.             call Switcher(TOSW)
  124.             call Switcher(MDV1)
  125.             Render Go
  126.                 call RecordAdd(SaveName,2,6,Compression)
  127.             end
  128.         end
  129.        if IBType = 1 then do
  130.         LoadBuffer PicBName Force 1
  131.         call Switcher(TOSW)
  132.         call Switcher(MDV1)
  133.         Render Go
  134.             call RecordAdd(SaveName,2*Padding,6,Compression)
  135.         end
  136.        if IBType = 2 then do
  137.         LoadBuffer PicBName Force
  138.         call Switcher(TOSW)
  139.         call Switcher(MDV1)
  140.         Render Go
  141.             call RecordAdd(SaveName,2*Padding,6,Compression)
  142.         end
  143.        if IBType = 3 then do
  144.         do Pad = 1 to Padding
  145.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  146.             call Switcher(TOSW)
  147.             call Switcher(MDV1)
  148.             Render Go
  149.                 call RecordAdd(SaveName,2,6,Compression)
  150.             end
  151.         end
  152.     end
  153. return
  154.  
  155. LoadA:
  156.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  157.         Undo On
  158.         exit
  159.         end
  160.     if i > Frames/2 then return
  161.     if IAType = 0 then do
  162.         LoadBuffer PicAName Force i+StartA
  163.         GetMain
  164.         parse var result Name Width Height Blah
  165.         if FieldSet = 0 then do
  166.             Hook DeInterlace
  167.             Scale Width Height
  168.             end
  169.         if FieldSet = 1 then do
  170.             Hook DeInterlace
  171.             Swap
  172.             Scale Width Height
  173.             end
  174.         end
  175.     if IAType = 1 then do
  176.         LoadBuffer PicAName Force 1
  177.         end
  178.     if IAType = 2 then do
  179.         LoadBuffer PicAName Force
  180.         end
  181.     if IAType = 3 then do
  182.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  183.         end
  184. return
  185.  
  186. LoadB:
  187.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  188.         Undo On
  189.         exit
  190.         end
  191.     if i <= Frames/2 then return
  192.     if IBType = 0 then do
  193.         LoadBuffer PicBName Force i+StartB
  194.         GetMain
  195.         parse var result Name Width Height Blah
  196.         if FieldSet = 0 then do
  197.             Hook DeInterlace
  198.             Scale Width Height
  199.             end
  200.         if FieldSet = 1 then do
  201.             Hook DeInterlace
  202.             Swap
  203.             Scale Width Height
  204.             end
  205.         end
  206.     if IBType = 1 then do
  207.         LoadBuffer PicBName Force 1
  208.         end
  209.     if IBType = 2 then do
  210.         LoadBuffer PicBName Force
  211.         end
  212.     if IBType = 3 then do
  213.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  214.         end
  215.  
  216.     if j < (TFrames-1) then do
  217.         if Type < 2 then do
  218.             HorizFlip
  219.             VertFlip
  220.             end
  221.         end
  222.  
  223. return
  224.  
  225.  
  226. DoIt:
  227.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  228.         Undo On
  229.         exit
  230.         end
  231.         
  232.     if j = 1 then do
  233.         return
  234.         end
  235.  
  236.     if j = TFrames then do
  237.         return
  238.         end
  239.  
  240.  
  241.     Num = (((j-1) * 180)/(TFrames-1))
  242.     Num = trunc(Num)
  243.     if Type = 1 then Num = -Num
  244.  
  245.  
  246.     if ColorPic = 1 then do
  247.         Swap
  248.         LoadBuffer PicName Force
  249.         if Scroll = 1 then
  250.             Roll XOff*j YOff*j
  251.         Swap
  252.         end
  253.     if ColorPic = 1 then 
  254.         Hook Perspective Num Num '0' '0' '0' '0' '0' '0' 0 -1 -1 0 SwapTile AntiAlias
  255.     else
  256.         Hook Perspective Num Num '0' '0' '0' '0' '0' '0' 0 -1 -1 0 DrawColor AntiAlias
  257. return
  258.  
  259. SaveIt:
  260.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  261.         Undo On
  262.         exit
  263.         end
  264.     if SaveType = 0 then do
  265.         call Switcher(TOSW)
  266.         call Switcher(MDV1)
  267.         Render Go
  268.         if Field = 1 then
  269.                 call RecordAdd(SaveName,1,6,Compression)
  270.         else
  271.                 call RecordAdd(SaveName,2,6,Compression)
  272.         end
  273.     if SaveType = 1 then do
  274.         if Field = 1 then do
  275.             f= f + 1
  276.             if f = 1 then
  277.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  278.             if f = 2 then do
  279.                 GetMain
  280.                 parse var result Name Width Height Blah
  281.                 Scale Width Height/2
  282.                 Swap
  283.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  284.                 Scale Width Height/2
  285.                 Hook Interlace
  286.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  287.                 f = 0
  288.                 end
  289.             end
  290.         else do
  291.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  292.             end    
  293.         end
  294.  
  295. return
  296.  
  297.